import request from '@/utils/request'

// 查询投票事项列表
export function listPolls(query) {
  return request({
    url: '/hdh/polls/list',
    method: 'get',
    params: query
  })
}

// 查询投票事项详细
export function getPolls(pollId) {
  return request({
    url: '/hdh/polls/' + pollId,
    method: 'get'
  })
}

// 新增投票事项
export function addPolls(data) {
  return request({
    url: '/hdh/polls',
    method: 'post',
    data: data
  })
}

// 修改投票事项
export function updatePolls(data) {
  return request({
    url: '/hdh/polls/edit',
    method: 'put',
    data: data
  })
}

// 删除投票事项
export function delPolls(pollId) {
  return request({
    url: '/hdh/polls/' + pollId,
    method: 'delete'
  })
}


//提交投票事项申请
export  function  submitPolls(pollId){
  return request({
    url: '/hdh/polls/submitPolls/' + pollId,
    method: 'get'
  })
}


// 查询未审批信息列表
export function listPollsNo(query) {
  return request({
    url: '/hdh/polls/listNo',
    method: 'get',
    params: query
  })
}

// 查询信息详细和批注
export function getHdhPollsComment(pollId) {
  return request({
    url: '/hdh/polls/getHdhPollsComment/' + pollId,
    method: 'get'
  })
}


// 审批信息
export function approveHdhPolls(data) {
  return request({
    url: '/hdh/polls/editnoapprove',
    method: 'post',
    data: data
  })
}

// 查询审批信息列表
export function listPollsFinished(query) {
  return request({
    url: '/hdh/polls/listFinished',
    method: 'get',
    params: query
  })
}


export function listpollsvoted(query) {
  return request({
    url: '/hdh/polls/listpollsvoted',
    method: 'get',
    params: query
  })
}
// 查询全部
export function getAllpolls() {
  return request({
    url: '/hdh/polls/getAllpolls',
    method: 'get'
  })
}

// 投票
export function votePolls(data) {
  return request({
    url: '/hdh/polls/vote',
    method: 'put',
    data: data
  })
}